<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <div class="not-found-container">
    <div class="error-content">
      <div class="error-illustration">
        <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 24 24" fill="none" stroke="#1890ff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
          <path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"></path>
          <line x1="4" y1="22" x2="4" y2="15"></line>
          <path d="M10 14v1a2 2 0 0 0 4 0v-1"></path>
          <path d="M10 4v3"></path>
          <path d="M14 4v3"></path>
        </svg>
      </div>
      <h1 class="error-title">404 Not Found</h1>
      <p class="error-description">抱歉，您访问的页面不存在或已被移除</p>
      <div class="error-actions">
        <el-button type="primary" size="large" @click="goHome" round>
          <i class="el-icon-house"></i> 返回首页
        </el-button>
        <el-button type="default" size="large" @click="goBack" round>
          <i class="el-icon-back"></i> 返回上一页
        </el-button>
      </div>
      <div class="error-search">
        <el-input 
          placeholder="搜索您需要的内容..." 
          v-model="searchQuery" 
          class="search-input"
          @keyup.enter="handleSearch"
        >
          <template #append>
            <el-button @click="handleSearch">
              <i class="el-icon-search"></i>
            </el-button>
          </template>
        </el-input>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const searchQuery = ref('')

const goHome = () => {
  router.push('/')
}

const goBack = () => {
  router.go(-1)
}

const handleSearch = () => {
  // 这里可以添加搜索逻辑
  if (searchQuery.value.trim()) {
    alert(`搜索: ${searchQuery.value}`)
    // 实际项目中可以跳转到搜索页面
    // router.push(`/search?q=${searchQuery.value}`)
  }
}
</script>

<style scoped>
.not-found-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4efe9 100%);
  padding: 20px;
}

.error-content {
  text-align: center;
  max-width: 600px;
  padding: 40px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.6s ease-out;
}

.error-illustration {
  margin-bottom: 24px;
}

.error-title {
  font-size: 2.5rem;
  color: #1890ff;
  margin-bottom: 16px;
  font-weight: 700;
}

.error-description {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 32px;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.error-search {
  margin-top: 32px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.search-input {
  border-radius: 24px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .error-content {
    padding: 24px;
  }
  
  .error-actions {
    flex-direction: column;
  }
  
  .error-title {
    font-size: 2rem;
  }
}
</style>